package com.blacktea.cloudconsumerfeignorder.config;

import feign.Logger;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * @description:
 * @author: black tea
 * @date: 2021/7/28 14:47
 */
@Configuration
// 配置负载均衡规则,默认轮询
//@RibbonClients(value = {@RibbonClient(name = "CLOUD-PROVIDER-PAYMENT-SERVICE",configuration = MySelfRule.class)})
// 配置扫描 feign接口的包地址
@EnableFeignClients(basePackages = "com.blacktea.cloudconsumerfeignorder.feign")

public class ApplicationContextConfig {

    @Bean
    @LoadBalanced // 使RestTemplate有负载均衡的能力
    public RestTemplate getRestTemplate(){
        return new RestTemplate();
    }

    @Bean
    Logger.Level feignLoggerLevel(){
        return Logger.Level.FULL;
    }
}
